home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-11-12 | 1.7 KB | 107 lines | [TEXT/CWIE] |
- UNIT Calcs;
-
- INTERFACE
-
- type
- ShortString = string[255];
- StrPtr = ^ShortString;
-
- {For DLLs, use CodeWarrior's default calling convention,}
- {which matches Delphi's "pascal" convention}
-
- function AddShort(i,j:integer): integer;
- {$IFC DLLTARGET}
- DLLEXPORT;
- {$ENDC}
-
- function AddLong(i,j:longint): longint;
- {$IFC DLLTARGET}
- DLLEXPORT;
- {$ENDC}
-
- function AddSingle(i,j:real): real;
- {$IFC DLLTARGET}
- DLLEXPORT;
- {$ENDC}
-
- function AddDouble(i,j:double): double;
- {$IFC DLLTARGET}
- DLLEXPORT;
- {$ENDC}
-
- procedure Add3Doubles(a,b,c:double; var total:double);
- {$IFC DLLTARGET}
- DLLEXPORT;
- {$ENDC}
-
- function XAdd3Doubles(a,b,c:double; var total:double): longint;
- {$IFC DLLTARGET}
- DLLEXPORT;
- {$ENDC}
-
- procedure GetTextFromDLL1(p:StrPtr; var S,L:longint);
- {$IFC DLLTARGET}
- DLLEXPORT;
- {$ENDC}
-
- procedure GetTextFromDLL2(var sss:ShortString; var S,L:longint);
- {$IFC DLLTARGET}
- DLLEXPORT;
- {$ENDC}
-
-
- {=======================================================================}
-
- IMPLEMENTATION
-
- function AddShort(i,j:integer): integer;
- begin
- AddShort := i + j;
- end;
-
- function AddLong(i,j:longint): longint;
- begin
- AddLong := i + j;
- end;
-
-
- function AddSingle(i,j:real): real;
- begin
- AddSingle := i + j;
- end;
-
-
- function AddDouble(i,j:double): double;
- begin
- AddDouble := i + j;
- end;
-
-
- function XAdd3Doubles(a,b,c:double; var total:double): longint;
- begin
- total := a + b + c;
- XAdd3Doubles := 0;
- end;
-
- procedure Add3Doubles(a,b,c:double; var total:double);
- begin
- total := a + b + c;
- end;
-
- procedure GetTextFromDLL1(p:StrPtr; var S,L:longint);
- begin
- p^[2] := '@';
- S := LENGTH(p^);
- end;
-
-
- procedure GetTextFromDLL2(var sss:ShortString; var S,L:longint);
- begin
- sss[2] := '@';
- S := LENGTH(sss);
- end;
-
-
-
- END.
-